import com.sun.scenario.effect.impl.sw.java.JSWColorAdjustPeer;

import java.util.Scanner;

/**
 * 需求：
 * 1.机票价格按照淡季旺季、头等舱和经济舱收费、输入机票原价、月份和头等舱或经济舱
 * 2.机票最终优惠价格的计算方案如下:
 * 旺季(5-10) 头等舱 9 折，经济舱8.5折
 * 淡季(11月到来年4月) 头等舱7折，经济舱6.5折
 */

public class FlyTickets {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("输入机票原价:");
        double ticketPrice = sc.nextDouble();
        System.out.println("输入月份(1-12):");
        int month = sc.nextInt();
        System.out.println("输入仓位类型:1-头等舱 0-经济舱");
        int cabinType = sc.nextInt();
        double actualPrice = count(ticketPrice, month, cabinType);
        System.out.println("机票最终价格为:"+actualPrice);
    }

    public static double count(double ticketPrice, int month, int cabinType) {
        switch (month) {
            case 1:
            case 2:
            case 3:
            case 4:
            case 11:
            case 12:
                if(cabinType==1){
                    return ticketPrice*0.7;
                }
                return ticketPrice*0.65;
            case 5:
            case 6:
            case 7:
            case 8:
            case 9:
            case 10:
                if(cabinType==1){
                    return ticketPrice*0.9;
                }
                return ticketPrice*0.85;
            default:
                System.out.println("月份输入有误!");
        }
        return ticketPrice;
    }

}
